<?php
$DEBUG=false;
if (isset($_GET['_DEBUG'])) $DEBUG=true;
//$DEBUG=true;
if ($DEBUG) error_reporting(E_ALL); else error_reporting(0);


define("THNOJ",TRUE);

define("MYSELF",$_SERVER["PHP_SELF"]);
$thispage = $_SERVER["PHP_SELF"];
session_start(); 
if (!isset($_SESSION['user_id'])) {
	define('IN_PHPBB', true);
	$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
	$phpEx = substr(strrchr(__FILE__, '.'), 1);
	include_once($phpbb_root_path . 'common.' . $phpEx);

	// Start session management
	$user->session_begin();
	$auth->acl($user->data);
	$user->setup();
	if ($user->data['user_id'] != ANONYMOUS)
	{
	   $_SESSION['user_id']=$user->data['username_clean'];
	   $_SESSION['user_name']=$user->data['username_clean'];
	   $_SESSION['user_email']=$user->data['user_email'];
	   $_SESSION['user_right']="C";
	}
}
require_once("functionbase.php");
$MEMBER=false;
$ADMIN=false;
$GV=false;
$GVVIP=false;
if (isset($_SESSION['user_id'])) {
	$myid = $_SESSION['user_id'];
	$MEMBER = true;
	if (isset($_SESSION['user_right'])) {
		switch ($_SESSION['user_right']) {
		case "A":
			$ADMIN = true;
		case "B":
			$GV=true;
		case "B1":
			$GV=true;
			$GVVIP=true;
		}
	}
}

if (isset($_SESSION['user_email'])) {
	$myemail=$_SESSION['user_email'];
	$user_email = $myemail;
}
if (isset($_SESSION['user_name'])){
	$myname=$_SESSION['user_name'];
}
date_default_timezone_set("Asia/Ho_Chi_Minh");
$admin_email="chamthitructuyen@gmail.com";

function write_log($log){
	mysql_query("insert into ctd_debug (moment,log) VALUE (NOW(),'".mysql_real_escape_string($log)."')");
}

?>
